from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QMessageBox

app = QApplication([])

win = QWidget()
win.setWindowTitle("按钮事件")

def on_click():
    QMessageBox.information(win, "提示", "按钮被点击了！")

btn = QPushButton("点我")
btn.clicked.connect(on_click)

layout = QVBoxLayout()
layout.addWidget(btn)
win.setLayout(layout)
win.show()
app.exec_()
